<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title> 拼多多优惠商城－大额商品优惠券，超高商品折扣 </title>
		<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1" />
		<meta name="keywords" content="限时特价，品牌专场，精选爆款，拼多多优惠商城" />
		<meta name="description" content="百万大额优惠券持续发放中，热销爆款好货，1.9超低价商品火爆抢购，惊喜不断！优惠不停！底到尖叫！" />
		<meta name="baidu-site-verification" content="tk4VA7ginX" />
		<meta name="360-site-verification" content="69745aea5bcc669978016bb0f049b47f" />
		<meta name="viewport" content="initial-scale=1.0, width=device-width" />
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<meta name="renderer" content="webkit" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta http-equiv="Cache-Control" content="no-cache,no-store,must-revalidate" />
		<meta http-equiv="Pragma" content="no-cache" />
		<meta http-equiv="Expires" content="0" />
		<meta http-equiv="x-dns-prefetch-control" content="on" />
 
		<link href="./css/antd.css" rel="stylesheet" />
		
		<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1" class="next-head" />
		<meta charset="utf-8" class="next-head" />
		<meta name="keywords" content="限时特价，品牌专场，精选爆款，拼多多优惠商城" class="next-head" />
		<meta name="description" content="百万大额优惠券持续发放中，热销爆款好货，1.9超低价商品火爆抢购，惊喜不断！优惠不停！底到尖叫！" class="next-head" />
		<meta name="baidu-site-verification" content="tk4VA7ginX" class="next-head" />
		<meta name="360-site-verification" content="69745aea5bcc669978016bb0f049b47f" class="next-head" />
        <link rel="stylesheet" href="./css/base.css">
        <link rel="stylesheet" href="./css/main.css">
		<link rel="stylesheet" href="./css/common.css">
		<script src="./js/jquery-3.3.1.js"></script>
		<script src="./js/PromiseAjax.js"></script>
		<script src="./js/cookie.js"></script>
		<script src="./js/myswiper.js"></script>
		<script src="./js/myTransImg.js"></script>
	</head>
	<body>
		<div id="__next">
			<div class="site-wrapper">
				<div class="search-bar">
					<div class="top-line"></div>
					<div class="content">
						<img
							src="./images/logo.png"
							alt=""
							class="logo-img"
						/>
						<div class="search-bar-input">
							<input
								type="text"
								placeholder="请输入商品名称"
								value=""
							/><span>搜索</span>
						</div>
						<div class="login-wrapper" style="display: flex;">
							<div>欢迎(<span class="myInfo"></span>)</div>
							<div style="margin-left: 20px;"><a href="./html/user/userList.html">我的购物车</a></div>
						</div>
					</div>
				</div>
				<div class="site">
					<div class="index-wrapper">
						<div class="index-top-wrapper">
							<div class="category-list-wrapper">
							</div>
							<div class="index-swiper-wrapper">
								<div class="card-title-wrapper">
									<div class="card-title-name">
										<div class="card-title-title">
											<img src="./images/8a390a.png" alt=""
												style="width: 17px;height: 17px;margin-right: 6px;"/>
                                                <span style=" color: rgb(227, 85, 76); " >个性主题</span>
										</div>
										<div class="card-title-desc">
                                            热门专题，放心选购
										</div>
									</div>
									<div class="card-title-more title-type-0 " >
										<span>更多</span>
                                        <img class="more-icon-type-0" src="./images/2cdb32b991a8e884f49b533437c95953.png"
											alt=""/>
                                        <!-- <img class="more-icon-type-red" src="//t16img.yangkeduo.com/mms_static/ceabdf30f3f7c9d04875109c7caa89e6.png"
											alt="" />
                                        <img class="more-icon-type-dark-bule" src="//t16img.yangkeduo.com/mms_static/e5ff2720b01287339025f89e8adbba3d.png"
											alt=""/>
                                        <img class="more-icon-type-1" src="//t16img.yangkeduo.com/mms_static/acf47b9b1e1cbf67b70cf0166683e7b7.png"
											alt=""/> -->
									</div>
								</div>
								<div class="slider-container">
									<div class="react-swipe-container slider" style="overflow: hidden;visibility: visible;position: relative;">
										<div style="overflow: hidden; position: relative;">
											<div class="transImg" style="height:350px;width:940px;">
												<!-- 轮播图 -->
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
						<div class="container">
							<div class="index-level-3 normal">
								<div class="index-normal-products-wrapper">
									<div class="card-title-wrapper">
										<div class="card-title-name">
											<div class="card-title-title">
												<div
													style="height: 21px;width: 4px;
														background-color: rgb(247,167,0);margin-right: 5px;
														margin-bottom: 3px;display: inline-block;vertical-align: sub;">
												</div>
												<span style="color: rgb(247, 167, 0);">精选</span>
											</div>
											<div class="card-title-desc">
												用心打造精致生活
											</div>
										</div>
										<div class="card-title-more title-type-1">
											<span>更多好货</span>
											<img class="more-icon-type-0" src="./images/swiperRight.png" alt="" />
											<img class="more-icon-type-red" src="./images/swiperRight1.png" alt="" />
											<img class="more-icon-type-dark-bule" src="./images/swiperRight2.png" alt="" />
											<img class="more-icon-type-1" src="./images/swiperRight3.png" alt="" />
										</div>
									</div>
									<div>
										<div class="index-normal-products-list normal">
											<!-- <div class="index-product-card card-type-2">
												<a>
													<img src="https://img.pddpic.com/gaudit-image/2021-12-19/77bee23e6ab67aa11195f9a3aca04a0b.jpeg" alt="" class="bottom-10"  />
													<div class="desc-container" >
														<p class="double-line-desc bottom-10">
															韩国现代绞肉机全自动家用绞陷机电动多功能料理打肉机器绞菜蒜蓉
														</p>
														<div class="price-container">
															<p class="after-coupon-price-type2">
																<span>券后</span><span>￥39.80</span>
															</p>
															<span class="origin-price">原价￥49.80</span>
														</div>
													</div>
												</a>
											</div> -->
										</div>
									</div>
								</div>
							</div>
						</div>
						
					</div>
				</div>
			</div>
		</div>
		<div class="foot">

		</div>
	</body>
	<script>
		let resId = getCookie("id");
		let username = getCookie("username");
		$(".myInfo").html(username);
		if (!resId){
			window.location.href = './login.html';
		}
		ajax({
			url:'./php/footer.php'
		}).then(res=>{
			$(".foot").html(res);
		});
		
	</script>
	<script>
		// 目录列表导航
		getCategoryList();
		renderTransImg();
		getTempList () ; 
		// console.log(wrapperEle);
		function getCategoryList(){
			// console.log(1111);
			ajax({
				url:'./php/index/getData.php',
				method:'post',
				dataType:'json',
				data:{
					opt:'getCategoryList',
				}
			}).then(res=>{
				let ulEle = document.querySelector(".category-list-wrapper");
				renderCategoryList(res,ulEle);
			});
		}
		function renderCategoryList(dataArr,ele){
			ele.innerHTML = '' ; 
			dataArr.forEach((item,key)=>{
				let aEle = document.createElement("a");	
				aEle.href = "javascript:;" ;
				aEle.setAttribute("myid",item['id']);
				aEle.innerHTML = `
					<div class="category-list-card" >
						<img src="./images/wwww.png" alt=""
						/>${item['typeName']}
					</div>`;
				ele.appendChild(aEle);			
				aEle.onclick = function(){
					let typeId = this.getAttribute("myid");
					window.location.href = `./html/proList.html?typeId=${typeId}` ; 
				}
			});
		}
		function renderTransImg(){
			ajax({
				url:'./php/index/getData.php',
				method:'post',
				dataType:'json',
				data:{
					opt:'getTransImg'
				}
			}).then(res=>{
				let transImgEle = document.querySelector(".slider-container .transImg");
				// console.log(res);
				let ImgArr = res.map(item=>"./"+item['transImg']);
				// new MySwiper(transImgEle,ImgArr);
				new TransImg(transImgEle,ImgArr);
			});	
		}
		function getTempList (){
			ajax({
				url:'./php/index/getData.php',
				method:'post',
				dataType:'json',
				data:{
					opt:'getTempList',
				}
			}).then(res=>{
				let containerEle = document.querySelector(".container");
				renderContainer( containerEle , res );
			});
		}
		function renderContainer( ele , dataArr ){
			ele.innerHTML = '' ;
			dataArr.forEach(item=>{
				let divEle = document.createElement("div");
				divEle.className = "index-level-3 normal" ;
				divEle.innerHTML = `
					<div class="index-normal-products-wrapper">
						<div class="card-title-wrapper">
							<div class="card-title-name">
								<div class="card-title-title">
									<div
										style="height: 21px;width: 4px;
											background-color:${item['color']};margin-right: 5px;
											margin-bottom: 3px;display: inline-block;vertical-align: sub;">
									</div>
									<span style="color: ${item['color']};">${item['temperName']}</span>
								</div>
								<div class="card-title-desc">
									${item['tDescribe']}
								</div>
							</div>
							<div class="card-title-more title-type-1">
								<span>更多好货</span>
								<img class="more-icon-type-0" src="./images/swiperRight.png" alt="" />
								<img class="more-icon-type-red" src="./images/swiperRight1.png" alt="" />
								<img class="more-icon-type-dark-bule" src="./images/swiperRight2.png" alt="" />
								<img class="more-icon-type-1" src="./images/swiperRight3.png" alt="" />
							</div>
						</div>
						<div>
							<div class="index-normal-products-list normal">
								
							</div>
						</div>
					</div>` ;
				let contentEle = divEle.querySelector(".normal");
				let temperId = item['temperId'] ;
				let temperNum = item['c'] ;
				getProList(contentEle,temperId,temperNum);
				ele.appendChild(divEle);
			});
		}

		function getProList(container,temperId,temperNum){
			ajax({
				url:'./php/index/getData.php',
				method:'post',
				dataType:'json',
				data:{
					temperId,
					temperNum,
					opt:'getProList',
				}
			}).then(res=>{
				renderProList1(container,res);
			});
		}
		function renderProList1(ele,dataArr){
			ele.innerHTML = '' ;
			dataArr.forEach((item,key)=>{
				let aEle = document.createElement("a");
				aEle.setAttribute("myid",item['id']);
				aEle.innerHTML = `
					<div class="index-product-card card-type-2">
						<img class="bottom-10" src="./${item['showImg']}" alt="" />
						<div class="desc-container">
							<p class="double-line-desc bottom-10">
								${item['pDescribe']}
							</p>
							<p class="sale-number bottom-10">
								销量${item['salesNum']}
							</p>
							<div class="price-container bottom-10">
								<p class="after-coupon-price-type2">
									<span>券后</span><span>￥${item['price']}</span>
								</p>
								<span class="origin-price">原价￥${item['price'] * 1.3 + 5.5}</span>
							</div>
						</div>
					</div>` ;
				aEle.onclick = function (){
					let pid = this.getAttribute("myid");
					window.location.href = `./html/user/details.html?pid=${pid}` ;
				}
				ele.appendChild(aEle);
			});
		}
		function renderProList2(ele,dataArr){
			ele.innerHTML = '' ;
			dataArr.forEach(item=>{
				let divEle = document.createElement("div");
				divEle.setAttribute("myid",item['id']);
				divEle.className = "index-product-card card-type-2" ;
				divEle.innerHTML = `
					<a>
						<img src="./${item['showImg']}" alt="" class="bottom-10"  />
						<div class="desc-container" >
							<p class="double-line-desc bottom-10">
								${item['pDescribe']}
							</p>
							<div class="price-container">
								<p class="after-coupon-price-type2">
									<span>券后</span><span>￥${item['price']}</span>
								</p>
								<span class="origin-price">原价￥${item['showImg'] * 1.3 + 5.5}</span>
							</div>
						</div>
					</a>` ;
				ele.appendChild(divEle);
			});
		}
	</script>
</html>
